<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      padding: 0;
      margin: 0;
    }
  </style>
</head>
<body>
  <!-- <section>
    <svg viewBox="0 0 750 800" 
      style="background-color: red;width: 100%;max-width: none!important;display: inline-block;"
    ></svg>
  </section> -->

  <!-- <section style="overflow: hidden;line-height: 0;">
    <section style="height: 0;line-height: 0;">
      <svg viewBox="0 0 750 1600" style="background-color: blue;width:100%;display: inline-block;"></svg>
    </section>

    <section style="height: 300px;"></section>
  </section> -->

  <!-- 
    单段自适应伸长动画
    <section style="overflow: hidden;line-height: 0;">
      <section style="height: 0;line-height: 0;">
        <svg viewBox="0 0 750 1600" style="background-color: blue;width:100%;display: inline-block;"></svg>
      </section>

      <svg viewBox="0 0 750 800" 
        style="background-color: red;width: 100%;max-width: none!important;display: inline-block;"
      >
        <animate attributeName="width" from="100%" to="200%" dur="1s" fill="freeze" begin="click" restart="never"></animate>
        <animate attributeName="opacify" begin="click" to="0" dur="0.1ms" fill="freeze" restart="never"></animate>
      </svg>
    </section> -->

  <!-- 多段自适应伸长动画 -->
  <section style="overflow: hidden;line-height: 0;">
    <section style="height: 0;line-height: 0;">
      <svg viewBox="0 0 750 800" style="background-color: red;width:100%;display: inline-block;"></svg>
      <svg viewBox="0 0 750 800" style="background-color: blue;width:100%;display: inline-block;"></svg>
      <svg viewBox="0 0 750 800" style="background-color: green;width:100%;display: inline-block;"></svg>
    </section>
    <section style="width: 50%;float: left;line-height: 0;pointer-events: none;">
      <svg viewBox="0 0 750 800" 
        style="width: 200%;max-width: none!important;display: inline-block;overflow:visible;transform: scale(1);pointer-events: none;"
      >
        <rect x="225" y="500" width="300" height="100" style="pointer-events: visible;"></rect>
        <animate attributeName="width" from="200%" to="400%" dur="1s" fill="freeze" begin="click" restart="never"></animate>
        <animate attributeName="opacity" begin="click" to="0" dur="0.1ms" fill="freeze" restart="never"></animate>
      </svg>
    </section>
    <section style="width: 50%;float: left;line-height: 0;pointer-events: none;">
      <svg viewBox="0 0 750 800" 
        style="width: 200%;max-width: none!important;display: inline-block;overflow:visible;transform: scale(1);pointer-events: none;"
      >
        <rect x="-150" y="1350" width="300" height="100" style="pointer-events: visible;"></rect>
        <animate attributeName="width" from="400%" to="600%" dur="1s" fill="freeze" begin="click" restart="never"></animate>
        <animate attributeName="opacify" begin="click" to="0" dur="0.1ms" fill="freeze" restart="never"></animate>
      </svg>
    </section>
  </section>
  <div style="height: 200px;"></div>
  <script>
    /*
      自适应宽度伸长动画原理

      触发器SVG
      <svg viewBox="0 0 750 800" style="width: 100%">
      </svg>

      viewBox 750x750  宽高比 750/800
      
    */
  </script>
</body>
</html>